#include "RenderScreen.hpp"

namespace sl
{
	namespace tmp
	{
		RenderScreenS::RenderScreenS() : WindowSettings(), Zoomable(), myFramerate(60)
		{}

		RenderScreenS::RenderScreenS(sf::VideoMode mode, const std::string& caption, char style, const sf::ContextSettings& settings) : WindowSettings(mode, caption, style, settings), Zoomable(), myFramerate(60)
		{}

		RenderScreenS::~RenderScreenS()
		{
			myWindow.Close();
		}

		bool RenderScreenS::Open()
		{
			myWindow.Create(myMode, myCaption, myStyle, mySettings);
			return myWindow.IsOpened();
		}

		sf::RenderWindow* RenderScreenS::GetWindow()
		{
			return &myWindow;
		}

		RenderScreenS* RenderScreenS::SetFramerate(unsigned int framerate)
		{
			myFramerate = framerate;
			myWindow.SetFramerateLimit(framerate);
			return this;
		}

		unsigned int RenderScreenS::GetFramerate()
		{
			return myFramerate;
		}

		RenderScreenS* RenderScreenS::Zoom(float zoomlevel)
		{
			sf::View default = myWindow.GetDefaultView();
			default.Zoom(zoomlevel);
			myWindow.SetView(default);
			return this;
		}

		sf::RenderWindow* RenderScreenS::operator()()
		{
			return &myWindow;
		}
	}
}